/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.championship;

import br.com.models.ClassRoom;

/**
 *
 * @author Valdigleis
 */
public class Gamer {
    
    //Id da jogador.
    private int id;
    
    private ClassRoom classRoom;
    
    private float attPriority;
    
    private float attPre;
    
    private float attCre;
    
    private float attFormation;
    
    private int victory;
    
    private int locado;

    public Gamer() {
        this.victory = 0;
        this.locado = 0;
        this.attCre = 0;
        this.attFormation = 0;
        this.attPre = 0;
        this.attPriority = 0;
    }
    
    /**
     * Método que computa as atualizações referentes a prioridade sobre
     * um horário que está vago.
     * @param n Número de dias que o professor pode dar aulas.
     * @param k Numero de aulas totais ainda livres.
     * @param pos Número de disciplinas o componente curricular "abre".
     */
    public void updateAttributs(float n, float k, int pos){
        updateAttPriority(n, k);
        updateAttPre(pos);
        updateAttCredits();
        updateAttFormation();
    }
    
    private void updateAttPriority(float n, float k){
        setAttPriority(1 - (n/k));
    }
    
    private void updateAttPre(int n){
        this.attPre = n;
    }
    
    private void updateAttCredits(){
       this.attCre = this.classRoom.getDiscipline().getCredits();
    }
    
    private void updateAttFormation(){
        float i,j,k;
        if(this.classRoom.getTeacher().getGraduation().getLevel().equals("Pós-doutrorado")){
            i = 10;
        }else{
            if(this.classRoom.getTeacher().getGraduation().getLevel().equals("Doutorado")){
                i = 5;
            }else{
                i = 3;
            }
        }
        if(this.classRoom.getTeacher().getGraduation().getSituation().equals("Em Andamento")){
            j = 10;
            k = 1 + Math.abs(this.classRoom.getTeacher().getGraduation().getTime()-8);
        }else{
            if(this.classRoom.getTeacher().getGraduation().getSituation().equals("Concluído")){
                j = 5;
                k = 1;
            }else{
                j = 3;
                k = 0;
            }
        }
        this.attFormation = (i*2+j*3+k*4)/9;
    }
    
    //------------------------------
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public ClassRoom getClassRoom() {
        return classRoom;
    }

    public void setClassRoom(ClassRoom classRoom) {
        this.classRoom = classRoom;
    }

    public int getVictory() {
        return victory;
    }

    public void setVictory(int victory) {
        this.victory = victory;
    }

    public float getAttPriority() {
        return attPriority;
    }

    public void setAttPriority(float attPriority) {
        this.attPriority = attPriority;
    }

    public float getAttPre() {
        return attPre;
    }

    public void setAttPre(float attPre) {
        this.attPre = attPre;
    }

    public float getAttCre() {
        return attCre;
    }

    public void setAttCre(float attCre) {
        this.attCre = attCre;
    }

    public float getAttFormation() {
        return attFormation;
    }

    public void setAttFormation(float attFormation) {
        this.attFormation = attFormation;
    }

    public int getLocado() {
        return locado;
    }

    public void setLocado(int locado) {
        this.locado = locado;
    }
    
}
